#!/bin/sh
#woof patches
#run this in the root dir of the woof tree #old, now runs from 3builddistro
#(C)01micko gpl3 (see /usr/share/doc/legal)
#20110819
#110822 BK modified, called from 3builddistro. runs with current-dir in 'sandbox3'.
#110825 01micko: some fixes.
#111015 01micko, remove icon and boot screen fixes, integrated in woof
#121108 01micko, fix gconv-modules.cache
#130801 removed fixes for dpi (gtkrc), remove old repos to help ppm
#140619 cleanup for 14.1

. ../DISTRO_SPECS

echo

## issues..
#if [ "$DISTRO_COMPAT_VERSION" = '14.2' ];then
#cat > rootfs-complete/etc/X11/xorg.conf.d/20-intel.conf <<_EOG
#Section "Device" 
#  Identifier "Card0" 
#  Driver "intel" 
#  Option "AccelMethod" "uxa" 
#EndSection
#_EOG
#	echo "Applying Intel 'UXA' work around"
#fi

#170519 override mime for svg to open defaultimageviewer
echo "fixing mimetype for svg and djvu"
mkdir -p rootfs-complete/root/.config/rox.sourceforge.net/MIME-types
(
cd rootfs-complete/root/.config/rox.sourceforge.net/MIME-types
echo '#!/bin/sh
exec defaultimageviewer "$1"' > image_svg
chmod 755 image_svg
ln -s image_svg image_svg+xml
)
(
cd rootfs-complete/etc/xdg/rox.sourceforge.net/MIME-types
ln -s application_pdf image_vnd.djvu
)
#121108 fix up gconv-modules.cache
# ***NOTICE*** cross-build, this will have to be executed at first boot... #01micko 121108
if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then
  [ ! -f rootfs-complete/usr/lib/gconv/gconv-modules.cache ] && chroot rootfs-complete /usr/sbin/iconvconfig
fi
echo "Generating /usr/lib/gconv/gconv-modules.cache"

#echo "fixing missing sylinks"
#(cd rootfs-complete/usr/bin; ln -sf ../../bin/sed . ; ln -sf ../../bin/grep . )

echo "removing redundant Slackware service scripts"
F=`ls rootfs-complete/etc/rc.d|grep '^rc\.'|grep -vE "update|sysinit|country|network|shutdown|local|services"`
for script in $F;do
	echo removing: ${script}
	rm -f rootfs-complete/etc/rc.d/${script}
done
echo

echo "removing extra .new files"
find rootfs-complete/etc -type f -name '*.new' -maxdepth 4 -delete
echo
echo "Slacko customisation complete"
echo
sleep 1

#exit 0
